perm filename STTINT.SAI[J17,SYS] blob sn#087588 filedate 1974-02-16 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	BEGIN "STATISTICS INTERPRETER"
C00004 00003	FOR I←0 STEP 1 UNTIL '77 DO JOBS[QUEUE,I]←-1
C00009 ENDMK
C⊗;
BEGIN "STATISTICS INTERPRETER"
EXTERNAL INTEGER _SKIP_;
INTEGER I,J,K,L,OP,EOF,VAL,OTHERHALF,OURJOB,LINES;
LABEL SKIP_OURJOB;
STRING S1,S2,S3,FILE;
DEFINE CRLF="'15&'12",TAB="'11",MAXLINES="52";
DEFINE NAME="1",SIZE="2",POSITION="3",QUEUE="4",JBTSIN="5",SEGMENT="6",
	GLUE="7",LOCK="8",SPW10="9",SPW6="10",MAXVAL="SPW6";
DEFINE _NQUEUES="'234",_QNAMS="'235";
INTEGER ARRAY JOBS[1:MAXVAL,0:'77];
STRING ARRAY QNAMS[-1:'77];
PRELOAD_WITH "INT",
	"PHANTOM",
	"COMMAND",
	"JOBRD",
	"SPW",
	['37-4]"UNDEF";
STRING ARRAY SINNAMES[0:'37];
DEFINE TITLE=
"""JOB #	OP	VALUE	SIZE(K)	POS	QUEUE	SEG #	JOBNAME	JBTSIN	JBTGLU	SPW10	SPW6""";
BOOLEAN HALF,DIRDEV,SPECIAL;
INTEGER PROCEDURE WORD;
IF HALF THEN BEGIN
	HALF←FALSE;
	RETURN(OTHERHALF);
	END
    ELSE BEGIN
	INTEGER TEMP;
	HALF←TRUE;
	TEMP←WORDIN(0);
	OTHERHALF←TEMP LAND '777777;
	RETURN(TEMP LSH -18);
	END;
PROCEDURE COUNT_LINE;
IF (LINES←LINES-1)<0 THEN BEGIN
	OUT(1,'14&TITLE&CRLF&CRLF);
	LINES←MAXLINES-3;
	END;
FOR I←0 STEP 1 UNTIL '77 DO JOBS[QUEUE,I]←-1;
I←CALL(_NQUEUES,"PEEK");
J←CALL(_QNAMS,"PEEK");
FOR K←0 STEP 1 UNTIL I DO QNAMS[K]←CVSTR(CALL(J+K,"PEEK"));
FOR I←I STEP 1 UNTIL '77 DO QNAMS[I]←"UNDEF";
OPEN(0,"DSK",'10,2,0,0,0,EOF);
LOOKUP(0,"STATS.DAT",EOF);
IF EOF THEN USERERR(0,0,"Can't find STATS.DAT");
HALF←FALSE;
S1←(IF CALL(CVSIX("LST"),"DEVCHR") THEN "LST" ELSE "DSK");
OPEN(1,S1,0,0,2,0,0,0);
DIRDEV←CALL(CVSIX(S1),"DEVCHR") LAND '4000000;
IF DIRDEV THEN BEGIN
	OUTSTR("Output file : ");
	IF EQU(NULL,FILE←INCHWL) THEN FILE←"STATS.LST";
	IF _SKIP_='175 THEN BEGIN
		OUTSTR(CRLF);
		SPECIAL←TRUE
		END ELSE SPECIAL←FALSE;
	ENTER(1,FILE,EOF);
	IF EOF THEN USERERR(0,0,"Can't enter "&FILE);
	PTOSTR(0,"SPOOL "&FILE);
	END;
OUT(1,TITLE&CRLF&CRLF);
LINES←MAXLINES-2;
OURJOB←WORD;
WHILE TRUE DO BEGIN
SKIP_OURJOB:	VAL←WORD;
	IF EOF THEN DONE;
	IF VAL=0 THEN GO TO SKIP_OURJOB;
	J←VAL LAND '77;
	IF VAL LAND '400000 THEN BEGIN
		OP←(VAL LSH -12)LAND '37;
		VAL←(VAL LSH -6)LAND '77;
		END
	    ELSE BEGIN
		OP←-1-(VAL LSH -14);
		VAL←(VAL LSH -6)LAND '377;
		END;
	S1←TAB&CVS(JOBS[SIZE,J])&TAB&
		(IF JOBS[SIZE,J] ∧ (I←JOBS[POSITION,J])=0 THEN "SWAPPED" ELSE CVOS(I))&
		TAB&QNAMS[JOBS[QUEUE,J]]&
		TAB&CVS(JOBS[SEGMENT,J])&TAB&CVXSTR(JOBS[NAME,J])&
		TAB&CVOS(JOBS[JBTSIN,J])&TAB&CVS(JOBS[GLUE,J])&
		TAB&CVOS(JOBS[SPW10,J])&TAB&CVOS(JOBS[SPW6,J])&CRLF;
	IF ¬(-3<OP<8) THEN BEGIN
		COUNT_LINE;
		OUT(1,"ILLEGAL OP-CODE, VALUE = "&CVS(OP)&CRLF);
		GO TO SKIP_OURJOB;
		END;
	CASE OP+2 OF BEGIN
		IF JOBS[POSITION,J]=0 ∧ JOBS[SIZE,J] THEN
			S3←"   *	SWAPIN	"&CVOS(JOBS[POSITION,J]←VAL LSH 10)
		    ELSE IF (I←JOBS[POSITION,J]←VAL LSH 10)=0 ∧ (K←JOBS[SIZE,J]) THEN
			S3←"   *	SWAP	OUT"
			    ELSE S3←"   *	SHUFFLE	"&CVOS(I);
		IF VAL=JOBS[SIZE,J] THEN GO TO SKIP_OURJOB
			ELSE S3←"	SIZE	"&CVS(JOBS[SIZE,J]←VAL);
		BEGIN
			VAL←(WORD LSH 18)+WORD;
			S3←"	NAME	"&CVXSTR(JOBS[NAME,J]←VAL);
		  END;
		S3←"	QUEUE	"&QNAMS[JOBS[QUEUE,J]←VAL];
		BEGIN
		  IF VAL LAND '40 THEN BEGIN
			S3←"     +";
			JOBS[JBTSIN,J]←JOBS[JBTSIN,J]LOR('400000 LSH -(VAL←VAL-'40));
			END
		    ELSE BEGIN
			S3←"     -";
			JOBS[JBTSIN,J]←JOBS[JBTSIN,J]LAND LNOT('400000 LSH -VAL);
			END;
		  S3←S3&"JBTSIN	"&SINNAMES[VAL];
		  END;
		IF VAL THEN S3←"	SEG #	"&CVS(JOBS[SEGMENT,J]←VAL)
			ELSE S3←"	FLUSHES	SEGMENT";
		IF VAL='77 THEN BEGIN
			S3←"	SPW	OFF";
			JOBS[SPW6,J]←JOBS[SPW10,J]←0;
			END
		  ELSE IF VAL LAND '40 THEN BEGIN
			VAL←VAL-'40;
			S3←"	SPW6	"&CVOS(VAL);
			JOBS[SPW6,J]←VAL;
			END
		    ELSE BEGIN
			S3←"	SPW10	"&CVOS(VAL);
			JOBS[SPW10,J]←VAL;
			END;
		IF JOBS[GLUE,J]←VAL THEN S3←"	GLUE	"&CVS(VAL)
			ELSE S3←"	UNGLUE	";
		S3←(IF JOBS[LOCK,J]←VAL THEN "	LOCK	" ELSE "	UNLOCK	");
		S3←"	FIT	IN";
		END;
	IF J=OURJOB THEN GO TO SKIP_OURJOB;
	IF (¬SPECIAL ∨ (OP=-2 ∨ OP=7)) ∧ JOBS[QUEUE,J]≥0 THEN BEGIN
		COUNT_LINE;
		OUT(1,(IF J<10 THEN " " ELSE NULL)&CVS(J)&S3&S1);
		END;
	END;
RELEASE(0);
RELEASE(1);
CALL(0,"EXIT");
END;